--subdir Build subdirectory instead of whole project
--prepare Script to run before build
--libdir Setup the project with a different libdir
+ --destdir Install the project to an additional destdir
-h, --help Display this help
--longoptions='subdir:' \
--longoptions='prepare:' \
--longoptions='libdir:' \
+ --longoptions='destdir:' \
--longoptions='help' \
-- "$@")
MESON_OPTIONS=()
SUBDIR=.
PREPARE=:
+DESTDIR=""
while true; do
case "$1" in
shift 2
;;
+ --destdir)
+ DESTDIR=$2
+ shift 2
+ ;;
+
-h|--help)
usage
exit 0
pushd "$CHECKOUT_DIR/$SUBDIR"
sh -c "$PREPARE"
meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
+
+# Install it to an additional directory e.g., system extension directory
+if [ -n "${DESTDIR}" ]; then
+ sudo meson install -C _build --destdir=$DESTDIR
+fi
+
sudo meson install -C _build
popd